#!/usr/bin/env php
<?php
if(! defined('E_DEPRECATED')) {
    define('E_DEPRECATED', 8192);
}
error_reporting(E_ALL & ~ E_DEPRECATED & ~ E_NOTICE);

$base_uri = DIRECTORY_SEPARATOR == '/' ? dirname($_SERVER["SCRIPT_NAME"]) : str_replace('\\', '/', dirname($_SERVER["SCRIPT_NAME"]));
define("BASE_URI", $base_uri == '/' ? '' : $base_uri);
unset($base_uri);
define('APP_NAME', 'oa-test');
define('APP_PATH', realpath(dirname(__FILE__)) . '/');
define('SYS_PATH', APP_PATH . "../../system/");

$G_LOAD_PATH = array(
    APP_PATH,
    APP_PATH."../app-oa-core/",
    APP_PATH."../app-oa-common/",
    APP_PATH."../app-oa-attendance/",
    SYS_PATH
);
$G_CONF_PATH = array(
    APP_PATH."config/",
    APP_PATH."../app-oa-attendance/config/",
    APP_PATH."../app-oa-core/config/",
    APP_PATH."../app-oa-attendance/config/",
    APP_PATH."../config/".APP_NAME."/",
);

$G_ROUTER_PATH = array(
    APP_PATH."config/",
    APP_PATH."../app-oa-core/config/",
    APP_PATH."../config/".APP_NAME."/",
);

require_once (SYS_PATH . "functions.php");
apf_require_class("APF");

$unit_libs = array(
        APP_PATH . "lib/dbunit",
        APP_PATH . "lib/php-code-coverage",
        APP_PATH . "lib/php-file-iterator",
        APP_PATH . "lib/php-invoker",
        APP_PATH . "lib/php-text-template",
        APP_PATH . "lib/php-timer",
        APP_PATH . "lib/php-token-stream",
        APP_PATH . "lib/phpunit",
        APP_PATH . "lib/phpunit-mock-objects",
        APP_PATH . "lib/phpunit-selenium",
        APP_PATH . "lib/phpunit-story"
);

$unit_include_path = join(":", $unit_libs);
ini_set('include_path', ".:$unit_include_path");
// $_SERVER['argv'] = array(
// 		0 => 'index.php',
// 		1 => '--stop-on-failure',
// 		2 => 'classes/aifang/test/inform'
// );
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
require 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
PHPUnit_TextUI_Command::main();
